home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
buffr2.zip
/
BD4_MAX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-01-04
|
3KB
|
117 lines
Unit BD4_Max; {Primitive 4-Dimensional BufferedArrays}
{$R-}
INTERFACE
Uses BND_Max;
Type
D4_BufferedArray = Object (BN_Max)
Procedure Init (ElementsPerDimension : DimensionPtr;
ElementSize : Word; MaxBuffSize : LongInt;
FileName : String);
Procedure Accept (W,X,Y,Z : LongInt; Var El; Size : Word);
{Assign the Addressed El}
Procedure Retrieve (W,X,Y,Z : LongInt; Var El; Size : Word);
{Get the Addressed El}
Procedure Swap (W1,X1,Y1,Z1,W2,X2,Y2,Z2 : LongInt);
{Swap the 1 and 2 Element}
Procedure Copy (From : D4_BufferedArray);
{Target *MUST* already be initialized}
{to the EXACT same parameters as From}
{this will save checking for sufficient}
{available Memory!}
(* no redefinition needed
Function MaxIndex (Index : Byte) : LongInt;
{Return the Max legal Index}
{for the Indexth Dimension}
Function MaxSize : LongInt;
{Report Total Number of Array Elements}
Function ElemSize : Word; {Report Element Size}
Procedure Destroy;
*)
End; {D4_BufferedArray}
IMPLEMENTATION
Procedure D4_BufferedArray.Init;
Begin
BN_Max.Init (4,ElementsPerDimension,ElementSize,MaxBuffSize,FileName)
End;
Procedure D4_BufferedArray.Accept (W,X,Y,Z : LongInt; Var El; Size : Word);
{Assign the Addressed El}
Var
I : Byte;
Begin
I := 0;
Add1^[I] := W; {even with range-checking off, the}
I := 1;
Add1^[I] := X; {compiler generates an error if}
I := 2; {a constant is used here. Dunno why...}
Add1^[I] := Y;
I := 3;
Add1^[I] := Z;
BN_Max.Accept (El,Add1,4,Size)
End;
Procedure D4_BufferedArray.Retrieve (W,X,Y,Z : LongInt; Var El; Size : Word);
{Get the Addressed El}
Var
I : Byte;
Begin
I := 0;
Add1^[I] := W;
I := 1;
Add1^[I] := X;
I := 2;
Add1^[I] := Y;
I := 3;
Add1^[I] := Z;
BN_Max.Retrieve (El,Add1,4,Size)
End;
Procedure D4_BufferedArray.Swap (W1,X1,Y1,Z1,W2,X2,Y2,Z2 : LongInt);
{Swap the 1 and 2 Element}
Var
I : Byte;
Begin
I := 0;
Add1^[I] := W1;
Add2^[I] := W2;
I := 1;
Add1^[I] := X1;
Add2^[I] := X2;
I := 2;
Add1^[I] := Y1;
Add2^[I] := Y2;
I := 3;
Add1^[I] := Z1;
Add2^[I] := Z2;
BN_Max.Swap (Add1,Add2,4)
End;
Procedure D4_BufferedArray.Copy (From : D4_BufferedArray);
{Redefined purely for type-checking}
Begin
BN_Max.Copy (From)
End;
BEGIN
END.